//
//  ForgetOneViewController.swift
//  HR
//
//  Created by zhenyu on 17/6/26.
//  Copyright © 2017年 allblue. All rights reserved.
//

import UIKit

class ForgetOneViewController: ViewController {
  
  weak var phoneView: HRTextFieldView!
  weak var codeView: HRTextFieldView!
  
  weak var nextBtn: Button!
  
  
  // MARK: - LifeCycle
  override func viewDidLoad() {
    super.viewDidLoad()
    setViews()
    // Do any additional setup after loading the view.
  }
  
  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }
  
  // MARK: - SetViews
  func setViews() {
    title = "忘记密码"
    
    let imageView = UIImageView(image: #imageLiteral(resourceName: "f_image1")).then { (i) in
      view.addSubview(i)
      }.then { (i) in
        i.snp.makeConstraints({ (make) in
          make.centerX.equalTo(view)
          make.top.equalTo(30)
          make.width.equalTo(152)
          make.height.equalTo(44)
        })
    }
    
    
    phoneView = HRTextFieldView(type: .normal).then({ (v) in
      view.addSubview(v)
      v.placeHolder = "请输入手机号码"
    }).then({ (v) in
      v.snp.makeConstraints({ (make) in
        make.top.equalTo(imageView.snp.bottom).offset(30)
        make.left.equalTo(view.snp.left).offset(15)
        make.right.equalTo(view.snp.right).offset(-15)
        make.height.equalTo(55)
      })
    })
    
    codeView = HRTextFieldView(type: .code).then({ (v) in
      view.addSubview(v)
      v.placeHolder = "请输入短信验证码"
    }).then({ (v) in
      v.snp.makeConstraints({ (make) in
        make.top.equalTo(phoneView.snp.bottom)
        make.left.right.equalTo(phoneView)
        make.height.equalTo(55)
      })
    })
    

    nextBtn = Button().then({ (b) in
      view.addSubview(b)
      b.title = "下一步"
      b.hlight()
      b.addTarget(self, action: #selector(nextAction), for: .touchUpInside)
    }).then({ (b) in
      b.snp.makeConstraints({ (make) in
        make.top.equalTo(codeView.snp.bottom).offset(30)
        make.left.right.equalTo(codeView)
        make.height.equalTo(44)
      })
    })
  }
}



// MARK: - Actions
extension ForgetOneViewController {
  func nextAction() {
    let vc = ForgetTwoViewController()
    Transition.push(vc: vc)
  }
}
